package com.jiamingZhao.sessoin;

import com.jiamingZhao.sessoin.impl.DefaultSqlSession;

public class SqlSessionFactory {
    private SqlSessionFactory() {
        throw new UnsupportedOperationException("不支持构造器实例化该对象");
    }


    private static volatile SqlSession sqlSession;

    public static SqlSession getSqlSession() {
        if (sqlSession == null) {
            synchronized (SqlSessionFactory.class) {
                if (sqlSession == null) {
                    sqlSession = DefaultSqlSession.getDefaultSqlSession();
                }
            }
        }
        return sqlSession;
    }
}